package com.liuqianfei.markme.rules.core;

import com.liuqianfei.markme.core.Token;
import com.liuqianfei.markme.rules.AbstractState;
import com.liuqianfei.markme.rules.IAction;

import java.util.List;

/**
 * @author liuqianfei
 */
public class InlineAction implements IAction
{
    @Override
    public boolean parse(AbstractState state, boolean silent, int startLine, int endLine)
    {
        List<Token> tokens = state.getTokens();
        Token tok;
        int i, l;

        // Parse inlines
        for (i = 0, l = tokens.size(); i < l; i++)
        {
            tok = tokens.get(i);
            if ("inline".equals(tok.type))
            {
                state.getMd().parserInline.parse(tok.content, state.getMd(), state.getEnv(), tok.children, tok);
            }
        }

        return true;
    }
}
